import { _decorator, Component} from 'cc';
const { ccclass, property } = _decorator;

@ccclass('StorageMgr')

export class StorageMgr extends Component {


    private static _ins: StorageMgr = null ;

    static get ins(): StorageMgr {
        if (this._ins == null) {
            this._ins = new StorageMgr();
        }
        return this._ins;
    }

    VERSION = '1.0_tt_'

    setStorage(name, value){
        localStorage.setItem(this.VERSION+name, JSON.stringify(value));
    }


    getStorage(name){
        if(localStorage.getItem(this.VERSION+name)){
            return JSON.parse(localStorage.getItem(this.VERSION+name));
        }else{
            return false
        }
    }

}


